# 创建时间:2023/5/19 15:00
# 创建人:天霄
# 计划 :SenjoTwintail
# 文件 :LevelsCalculator.py
# 基于 Python 3.8.2
# ========================================
# 等级计算规则
# ========================================

# ===好感度经验===


class LevelsCalculator:
    """等级计算器"""
    def __init__(self):
        self._favorLevel_formula = lambda lv: 10 * lv ** 2
        '''好感度：该等级的经验条计算公式'''
        property(self._favorLevel_formula)

    def rankLevel_count(self, nowLevel: int, nowExp: int):
        """根据等级经验计算当前经验值是否需升级"""

    def favorLevel_count(self, nowLevel: int, nowExp: int):
        """根据好感度经验计算当前经验值是否需升级

        :param nowLevel: 当前等级
        :param nowExp: 当前经验值
        :return: 升级后的等级、经验值、经验条
        """
        while 1:
            upExp = self._favorLevel_formula(nowLevel)
            if nowLevel >= 15:
                nowExp = 0
                return nowLevel, nowExp, upExp
            if nowExp >= upExp:
                nowLevel += 1
                nowExp -= upExp
                continue
            return nowLevel, nowExp, upExp










